package com.zkgl.rent.service.impl;

import java.util.List;

import com.zkgl.common.annotation.DataScope;
import com.zkgl.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zkgl.rent.mapper.RentBillMapper;
import com.zkgl.rent.domain.RentBill;
import com.zkgl.rent.service.IRentBillService;

/**
 * 租金账单Service业务层处理
 * 
 * @author macro
 * @date 2025-09-25
 */
@Service
public class RentBillServiceImpl implements IRentBillService 
{
    @Autowired
    private RentBillMapper rentBillMapper;

    /**
     * 查询租金账单
     * 
     * @param id 租金账单主键
     * @return 租金账单
     */
    @Override
    public RentBill selectRentBillById(Long id)
    {
        return rentBillMapper.selectRentBillById(id);
    }

    /**
     * 查询租金账单列表
     * 
     * @param rentBill 租金账单
     * @return 租金账单
     */
    @Override
    @DataScope(userAlias = "su")
    public List<RentBill> selectRentBillList(RentBill rentBill)
    {
        return rentBillMapper.selectRentBillList(rentBill);
    }

    /**
     * 新增租金账单
     * 
     * @param rentBill 租金账单
     * @return 结果
     */
    @Override
    public int insertRentBill(RentBill rentBill)
    {
        rentBill.setCreateTime(DateUtils.getNowDate());
        return rentBillMapper.insertRentBill(rentBill);
    }

    /**
     * 修改租金账单
     * 
     * @param rentBill 租金账单
     * @return 结果
     */
    @Override
    public int updateRentBill(RentBill rentBill)
    {
        rentBill.setUpdateTime(DateUtils.getNowDate());
        return rentBillMapper.updateRentBill(rentBill);
    }

    /**
     * 批量删除租金账单
     * 
     * @param ids 需要删除的租金账单主键
     * @return 结果
     */
    @Override
    public int deleteRentBillByIds(Long[] ids)
    {
        return rentBillMapper.deleteRentBillByIds(ids);
    }

    /**
     * 删除租金账单信息
     * 
     * @param id 租金账单主键
     * @return 结果
     */
    @Override
    public int deleteRentBillById(Long id)
    {
        return rentBillMapper.deleteRentBillById(id);
    }
}
